package com.pinoc.demo.config;

import com.pinoc.demo.common.es.EsRestHighLevelClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author yinpeng
 */
@Configuration
public class EsConfiguration {

	@Value(value = "${es.host.name}")
	private String esHostName;

	@Value(value = "${es.port}")
	private int port;

	@Value(value = "${es.schema}")
	private String schema;

	@Bean(name = "esRestHighLevelClient")
	public EsRestHighLevelClient esRestHighLevelClient() {
		EsRestHighLevelClient esRestHighLevelClient = new EsRestHighLevelClient(esHostName, port, schema);
		System.out.println(esRestHighLevelClient.toString());
		return esRestHighLevelClient;
	}
}
